#include "stdafx.h"
#include "MacroFunction.h"

#define MULTI2(__x) printf("%d x %d = %d\n", __x, __x, (__x * __x));
#define COMP2(__a, __b) (__a > __b ? __a : __b)

void MacroFunctionTester::Multi(const int __var)
{
	printf("%d x %d = %d\n", __var, __var, (__var * __var));
}

const int MacroFunctionTester::Comp(const int __var1, const int __var2)
{
	return __var1 > __var2 ? __var1 : __var2;
}

void MacroFunctionTester::TestMulti_Def()
{
	int _a = 5;
	MULTI2(++_a);
}

void MacroFunctionTester::TestMulti()
{
	int _var = 5;
	Multi(++_var);
}

void MacroFunctionTester::TestComp_Def()
{
	int _v1 = 5, _v2 = 0;
	auto _r1 = COMP2(++_v1, _v2);
	printf("var1 : %d, var2 : %d >> %d\n", _v1, _v2, _r1);

	_v1 = 5, _v2 = 0;
	auto _r2 = COMP2(++_v1, _v2 + 10);
	printf("var1 : %d, var2 : %d >> %d\n", _v1, _v2, _r2);
}

void MacroFunctionTester::TestComp()
{
	int _v1 = 5, _v2 = 0;
	auto _r1 = Comp(++_v1, _v2);
	printf("var1 : %d, var2 : %d >> %d\n", _v1, _v2, _r1);

	_v1 = 5, _v2 = 0;
	auto _r2 = Comp(++_v1, _v2 + 10);
	printf("var1 : %d, var2 : %d >> %d\n", _v1, _v2, _r2);
}
